package com.retailshop.shopuser.common;

import com.retailshop.shopuser.entity.PostJson;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

public class ResquestUtil {

    public Object sendPost(String url, MultiValueMap<String, String> map){
        RestTemplate restTemplate = new RestTemplate();
//        String url = "http://192.168.0.133:8086/wap/applyStoreInfo";
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
//
//        MultiValueMap<String, String> map= new LinkedMultiValueMap<>();
//
//        map.add("userNoId", "10009");
//        map.add("storeName", "贵阳店铺");
//        map.add("storeLogo", "/844072586.png");

        HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
        ResponseEntity<String> response = restTemplate.postForEntity( url, request , String.class );
        System.out.println(response.getBody());
        return  response;
    }
}
